package gare.quai;

import thread.Train;

public class Voie {
	
	private int		id;
	
	private Train	train;
	
	public Voie(int id) {
		this.id = id;
	}
	
	public boolean estLibre() {
		return train == null;
	}
	
	public void accueillir(Train train) {
		this.train = train;
	}
	
	public String toString() {
		return "Voie " + id;
	}
	
	public boolean occupePar(Train t) {
		return train != null && train == t;
	}
	
	public Train getTrain() {
		return train;
	}
	
	public void afficher() {
		String t = (train == null) ? "Vide" : train.toString();
		System.out.print("[" + id + ":" + t + "] ");
	}
}
